#ifndef LIGHT_SPOT_H_
#define LIGHT_SPOT_H_

#include "light.h"

class LightSpot : public Light{
	private:
		float _cutoff;
		Point _direction;
	public:
		LightSpot(){
		}

		LightSpot(const Point& pos,RGBAColor diffuse,RGBAColor ambient,Point dir,float cutoff,float cA=1.0f,float lA=0.0f,float qA=0.0f)
			:	Light(pos,diffuse,ambient,cA,lA,qA){
			_direction = dir;
			_cutoff = cutoff;
		}
		virtual ~LightSpot(){}

		Point direction(){ return _direction; }
		void direction(Point dir){ _direction=dir; }

		float cutoff(){ return _cutoff; }
		void cutoff(float cutoff){ _cutoff=cutoff; }

	private:
		void on(unsigned int j){
			if(!_on){
				glLightf(GL_LIGHT0+j, GL_SPOT_CUTOFF, _cutoff);
				glLightfv(GL_LIGHT0+j, GL_SPOT_DIRECTION, (GLfloat*)(&_direction));

				Light::on(j);
			}
		}
};


#endif /* LIGHT_SPOT_H_ */
